package com.xuecheng.openfeign.fallback;

import com.xuecheng.openfeign.client.ItemClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;

@Slf4j
public class ItemClientFallbackFactory implements FallbackFactory<ItemClient> {
    @Override
    public ItemClient create(Throwable cause) {
        return null;
    }
//    @Override
//    public ItemClient create(Throwable cause) {
//        return new ItemClient() {
//            @Override
//            public List<ItemDTO> queryItemByIds(Set<Long> ids) {
//                log.info("查询商品信息失败",cause);
//                return CollUtils.emptyList();
//            }
//
//            @Override
//            public void deductStock(List<OrderDetailDTO> items) {
//                log.info("扣减库存失败",cause);
//                throw new RuntimeException(cause);
//            }
//        };
//    }
}
